using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Mvc.Ajax;
using MyStackMvc.Models;

namespace MyStackMvc.Controllers
{
    public class StackController : Controller
    {
        //
        // GET: /Stack/

        public ActionResult Index()
        {
            return View("Push");
        }

        
        public ActionResult Push(int id)
        {
            return View("Push", id);
        }

        [AcceptVerbs(HttpVerbs.Post)]
        public ActionResult Push(int id, FormCollection formValues)
        {
            string title = formValues["Title"];
            string content = formValues["Content"];

            MyStackRepository db = new MyStackRepository();

            int storyId = db.PushStory(id, title, content);

            // TODO: put in DB

            return View("Push", id);
        }
    }
}
